#include "dimention.h" 


int get_size(dim_struct* dim) {
	if(dim == NULL) return 0;
	if(dim->next == NULL) return dim->dim_size;
	return dim->dim_size * get_size(dim->next);
}

dim_struct* get_dim(int dist_voisinage, int nb_dim) {
	dim_struct* res = NULL;
	int i;
	for(i=0;i<nb_dim;i++){
		dim_struct* dim = malloc(sizeof(dim_struct));
		dim->dim_size = (2*dist_voisinage)+1;
		dim->next = res;
		res = dim;
	}
	return res;
}

int get_dim_size(dim_struct* dimentions, int index) {
	int i;
	for(i=0;i<=index;i++){
		if(i==index)return dimentions->dim_size;
		if(dimentions->next == NULL) { printf("Le tableau n'a pas autant de dimentions ! \n");exit(0);}
		dimentions = dimentions->next;
	}
	return 0;
}
